;*****************************************************
; 	Copyright (C) SEIKO EPSON CORP. 1997-2001
;	All rights Reserved
;
;	File name : strlen.s
;	Function  :
;	       This is strlen function
;	Revision  :
;		1997/03/25	V.Chan start
;		2001/12/06	T.Tazaki for GNU33(Linux)
;*****************************************************

;*****************************************************
; strlen
;	returns length of characters in src (0 terminated)
;
; arguments : %r6:src addr
; return    : %r4:length
;*****************************************************

	.section .text
	.align 1
	.global strlen
	.type	strlen,@function

strlen:
	ld.w	%r4, -1			; initialize result

strlen_loop:
	ld.ub	%r10, [%r6]+	; add char to dest
	cmp		%r10, 0
	jrne.d	strlen_loop
	add		%r4, 1

	ret

